Hello all,
I have done a bit of search on how to left/center/right justify column headings in proc print but haven't found much... I have found 'Style' and 'Justify' but neither seem to work in my code.
Please let me know if you know how this can be done.
Many thanks ![]()
Hi:
I do not see any code where you have actually TRIED style= with justification overrides. Can you try a report using SASHELP.CLASS and see whether your STYLE override works? For example, the code below justifies correctly (and changes colors correctly) for me. I made the report wide so you could REALLY see the impact of the justification.
cynthia
ods _all_ close;
ods html file='c:\temp\print_just.html' style=sasweb;
proc print data=sashelp.class(obs=3)
style(header)={just=c foreground=black}
style(table)={width=100%};
title 'Make the report very wide to see justification';
var name / style(data)={just=r}
style(header)={background=pink};
var age / style(data)={just=l};
var sex height / style(data)={just=c}
style(header)={background=yellow};
var weight / style(data)={just=l};
run;
ods html close;
What code?
It's a simple proc print outputing to HTML.... it looks something like this:
ods html file="**********";
proc print data= **********%scan(&FEDs.,&i.)_c9 (drop=NEW_ED_Code OLD_ED_Code) split="*" noobs;
Title1 "&&FEDPr&i.";
Footnote1 "**********";
label **********;
format **********.;
run;
ods html close;
Thanks ![]()
Hi:
I do not see any code where you have actually TRIED style= with justification overrides. Can you try a report using SASHELP.CLASS and see whether your STYLE override works? For example, the code below justifies correctly (and changes colors correctly) for me. I made the report wide so you could REALLY see the impact of the justification.
cynthia
ods _all_ close;
ods html file='c:\temp\print_just.html' style=sasweb;
proc print data=sashelp.class(obs=3)
style(header)={just=c foreground=black}
style(table)={width=100%};
title 'Make the report very wide to see justification';
var name / style(data)={just=r}
style(header)={background=pink};
var age / style(data)={just=l};
var sex height / style(data)={just=c}
style(header)={background=yellow};
var weight / style(data)={just=l};
run;
ods html close;
Thank you, my code works now!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.